1. /* sffffmul.cpp by K.Tsuru */
  2. // function ID = 712 DRADIX
  3. /*************************************
  4. SFraction class
  5. It provides the multiplication "x*y".
  6. (x.num/x.den)*(y.num/y.den)
  7. *************************************/
  8. #ifndef SN_H
  9. #include "sn.h"
  10. #endif
  11. SFraction FFMult(const SFraction& x, const SFraction& y){
  12. SFraction z; // z.reduceDone = false;
  13. if(x.Sign(712) == 0){
  14. z.SetZero(); return z;
  15. }
  16. #if REDUCE_SIZE==0
  17. SLong d1 = gcdL(x.num, y.den), d2 = gcdL(x.den, y.num);
  18. z.num = (x.num/d1)*(y.num/d2); z.den = (x.den/d2)*(y.den/d1);
  19. z.reduceDone = true;
  20. #else
  21. if(x.ReduceStepByStep()) {
  22. SLong d1 = gcdL(x.num, y.den), d2 = gcdL(x.den, y.num);
  23. z.num = (x.num/d1)*(y.num/d2); z.den = (x.den/d2)*(y.den/d1);
  24. z.reduceDone = true;
  25. } else {
  26. z.num = x.num*y.num; z.den = x.den*y.den;
  27. z.reduce(false);
  28. }
  29. #endif
  30. return z;
  31. }

sffffmul.cpp : last modifiled at 2017/10/20 10:44:47(884 bytes)
created at 2015/12/22 16:07:29
The creation time of this html file is 2017/10/21 15:10:35 (Sat Oct 21 15:10:35 2017).